commit - 02a9e99535e18f69e38c094b381dbd90621a2783
commit + f9d1117339630f1ef508a9db8fd3d832061ad605
blob - 9f56f71abaf2f27bce1a2db6a03fcb31eec8511e
blob + 037c89356a5859851914198810a1c10abea434db
--- cvg/cvg.c
+++ cvg/cvg.c
if (error)
goto done;
- if (author == NULL)
+ if (author == NULL) {
+ /* got_worktree_cvg_commit() treats committer as optional */
author = committer;
+ committer = NULL; /* => author timestamp is ignored */
+ }
remote_name = GOT_SEND_DEFAULT_REMOTE_NAME;
worktree_conf = got_worktree_get_gotconfig(worktree);
cl_arg.repo_path = got_repo_get_path(repo);
cl_arg.dial_proto = proto;
error = got_worktree_cvg_commit(&id, worktree, &paths, author,
- 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);
+ 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);
if (error) {
if (error->code != GOT_ERR_COMMIT_MSG_EMPTY &&
cl_arg.logmsg_path != NULL)
blob - 057137a8ccbd155e4eebbe781aa2acbab0177706
blob + 53abcb2f9c7ae9bf78e62ccf590a8abdb75eedc5
--- include/got_worktree_cvg.h
+++ include/got_worktree_cvg.h
* 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.
* 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.
*/
const struct got_error *got_worktree_cvg_commit(struct got_object_id **,
- struct got_worktree *, struct got_pathlist_head *, const char *,
+ struct got_worktree *, struct got_pathlist_head *, const char *, time_t,
const char *, int, int, int, got_worktree_commit_msg_cb, void *,
got_worktree_status_cb, void *, const char *, const char *, const char *,
const char *, const char *, const char *, int,
blob - 2aa66b6119819465449e3153ff18ad42e03458d3
blob + 5b9b1c532c0d687ea6a7630ba195c953fd2add73
--- lib/worktree_cvg.c
+++ lib/worktree_cvg.c
struct got_object_id *head_commit_id,
struct got_object_id *parent_id2,
struct got_worktree *worktree,
- const char *author, const char *committer, char *diff_path,
- got_worktree_commit_msg_cb commit_msg_cb, void *commit_arg,
+ const char *author, time_t author_time, const char *committer,
+ char *diff_path, got_worktree_commit_msg_cb commit_msg_cb, void *commit_arg,
got_worktree_status_cb status_cb, void *status_arg,
struct got_repository *repo)
{
nparents++;
}
timestamp = time(NULL);
+ if (committer == NULL)
+ author_time = timestamp;
err = got_object_commit_create(new_commit_id, new_tree_id, &parent_ids,
- nparents, author, timestamp, committer, timestamp, logmsg, repo);
+ nparents, author, author_time, committer, timestamp, logmsg, repo);
if (logmsg != NULL)
free(logmsg);
if (err)
const struct got_error *
got_worktree_cvg_commit(struct got_object_id **new_commit_id,
struct got_worktree *worktree, struct got_pathlist_head *paths,
- const char *author, const char *committer, int allow_bad_symlinks,
- int show_diff, int commit_conflicts,
+ const char *author, time_t author_time, const char *committer,
+ int allow_bad_symlinks, int show_diff, int commit_conflicts,
got_worktree_commit_msg_cb commit_msg_cb, void *commit_arg,
got_worktree_status_cb status_cb, void *status_arg,
const char *proto, const char *host, const char *port,
}
err = commit_worktree(new_commit_id, &commitable_paths,
- head_commit_id, NULL, worktree, author, committer,
+ head_commit_id, NULL, worktree, author, author_time, committer,
(diff_path && cc_arg.diff_header_shown) ? diff_path : NULL,
commit_msg_cb, commit_arg, status_cb, status_arg, repo);
if (err)