Commit Diff


commit - 614433e1dca199fc027506a6b9148f54677ca1280aec030e062dbd4bd8ca7133
commit + b16ecebc96da75afd8b4546b4444f1c308aed91780f5998445e8b39434d89c48
blob - b393f090b9fc9dffffc7d15bbe8fe9e3ee8b5cf639860e8eaf358d67303e3c58
blob + 62f39517c2c28c0607d9e7d319c40fd04de1569d394abfb2dd1b2ee53b565dcc
--- cvg/cvg.c	
+++ cvg/cvg.c	
@@ -7936,11 +7936,8 @@ cmd_commit(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	if (author == NULL) {
-		/* got_worktree_cvg_commit() treats committer as optional */
+	if (author == NULL)
 		author = committer;
-		committer = NULL;	/* => author timestamp is ignored */
-	}
 
 	remote_name = GOT_SEND_DEFAULT_REMOTE_NAME;
 	worktree_conf = got_worktree_get_gotconfig(worktree);
@@ -8052,11 +8049,11 @@ cmd_commit(int argc, char *argv[])
 	cl_arg.worktree_path = got_worktree_get_root_path(worktree);
 	cl_arg.repo_path = got_repo_get_path(repo);
 	cl_arg.dial_proto = proto;
-	error = got_worktree_cvg_commit(&id, worktree, &paths, author,
-	    time(NULL), committer, allow_bad_symlinks, show_diff,
-	    commit_conflicts, collect_commit_logmsg, &cl_arg, print_status,
-	    NULL, proto, host, port, server_path, jumphost, identity_file,
-	    verbosity, remote, check_cancelled, repo);
+	error = got_worktree_cvg_commit(&id, worktree, &paths, author, 0,
+	    committer, allow_bad_symlinks, show_diff, commit_conflicts,
+	    collect_commit_logmsg, &cl_arg, print_status, NULL, proto, host,
+	    port, server_path, jumphost, identity_file, verbosity, remote,
+	    check_cancelled, repo);
 	if (error) {
 		if (error->code != GOT_ERR_COMMIT_MSG_EMPTY &&
 		    cl_arg.logmsg_path != NULL)
blob - abc7ebf6fd653873ea4232592e68f6f627170d23879f0b41e61f71c393c8e5de
blob + 3bc07ba130b4f40de63970db2c32d95b135075afe86ab18a559132e60384166b
--- got/got.c	
+++ got/got.c	
@@ -9663,11 +9663,8 @@ cmd_commit(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	if (author == NULL) {
-		/* got_worktree_commit() treats committer as the optional one */
+	if (author == NULL)
 		author = committer;
-		committer = NULL;	/* => author timestamp is ignored */
-	}
 
 	if (logmsg == NULL || strlen(logmsg) == 0) {
 		error = get_editor(&editor);
@@ -9717,7 +9714,7 @@ cmd_commit(int argc, char *argv[])
 		cl_arg.branch_name += 11;
 	}
 	cl_arg.repo_path = got_repo_get_path(repo);
-	error = got_worktree_commit(&id, worktree, &paths, author, time(NULL),
+	error = got_worktree_commit(&id, worktree, &paths, author, 0,
 	    committer, allow_bad_symlinks, show_diff, commit_conflicts,
 	    collect_commit_logmsg, &cl_arg, print_status, NULL, repo);
 	if (error) {
blob - d61664a20c9032ebf725665ac626988811d55e001d0ffb2292d19fb1a02862d8
blob + 4513112b75aa78380e5c34d41882d63dd15070bc3581e4b317bf1eb81f4e70aa
--- include/got_worktree.h	
+++ include/got_worktree.h	
@@ -280,8 +280,8 @@ typedef const struct got_error *(*got_worktree_commit_
  * current base commit.
  * An author and a non-empty log message must be specified.
  * The name of the committer is optional (may be NULL).
- * If a committer is given, a separate author timestamp can be specified
- * which is ignored otherwise.
+ * An optional author timestamp can be specified. The current time will
+ * be used if the specified timestamp is 0.
  * If a path to be committed contains a symlink which points outside
  * of the path space under version control, raise an error unless
  * committing of such paths is being forced by the caller.
blob - fee4852672cae1893d2f5d7cd37e28663db4ffa714a76aaaff93a216cac7b1e0
blob + f6afd0937c50fe4c75571bcf0cee5bcc2e57324c949d2e563dc15e9d0b4a8479
--- include/got_worktree_cvg.h	
+++ include/got_worktree_cvg.h	
@@ -23,8 +23,8 @@
  * current base commit.
  * An author and a non-empty log message must be specified.
  * The name of the committer is optional (may be NULL).
- * If a committer is given, a separate author timestamp can be specified
- * which is ignored otherwise.
+ * An optional author timestamp can be specified. The current time will
+ * be used if the specified timestamp is 0.
  * If a path to be committed contains a symlink which points outside
  * of the path space under version control, raise an error unless
  * committing of such paths is being forced by the caller.
blob - 634873859d83f70a01657896fa36ec8dd97da9c1bcf92886d6e70c1c4b63265a
blob + 0628d1a8616a2cf74ab9aac4f79f889d7a24442ba2193c2dae4adbf492beb7d3
--- lib/worktree.c	
+++ lib/worktree.c	
@@ -6559,7 +6559,7 @@ commit_worktree(struct got_object_id **new_commit_id,
 		nparents++;
 	}
 	timestamp = time(NULL);
-	if (committer == NULL)
+	if (author_time == 0)
 		author_time = timestamp;
 	err = got_object_commit_create(new_commit_id, new_tree_id, &parent_ids,
 	    nparents, author, author_time, committer, timestamp, logmsg, repo);