commit - c12ab9ad7f32b9eb712734e776de2f7b0370e643
commit + b16f18320c2d00bb467b50672a03e2665791ceda
blob - b891d7925d4d755ef4a58c41f98faa442f669735
blob + 9d58d1d4f3c73ef9a8754f4cbf4e8532acff5a2a
--- got/got.c
+++ got/got.c
struct got_repository *repo = NULL;
struct got_fileindex *fileindex = NULL;
char *cwd = NULL, *id_str = NULL, *author = NULL;
+ char *gitconfig_path = NULL;
struct got_reference *branch = NULL, *wt_branch = NULL;
struct got_object_id *branch_tip = NULL, *yca_id = NULL;
struct got_object_id *wt_branch_tip = NULL;
goto done;
}
+ error = get_gitconfig_path(&gitconfig_path);
+ if (error)
+ goto done;
error = got_repo_open(&repo,
- worktree ? got_worktree_get_repo_path(worktree) : cwd, NULL,
- pack_fds);
+ worktree ? got_worktree_get_repo_path(worktree) : cwd,
+ gitconfig_path, pack_fds);
if (error != NULL)
goto done;
}
done:
+ free(gitconfig_path);
free(id_str);
free(merge_commit_id);
free(author);
blob - 43fc62a9959f02a646f8a0777654f8bce35c3878
blob + 876eced1d6b84caf0d92277204c67399f2876875
--- regress/cmdline/merge.sh
+++ regress/cmdline/merge.sh
test_done "$testroot" 0
}
+
+test_merge_gitconfig_author() {
+ local testroot=`test_init merge_gitconfig_author`
+
+ (cd $testroot/repo && git config user.name 'Flan Luck')
+ (cd $testroot/repo && git config user.email 'flan_luck@openbsd.org')
+
+ (cd $testroot/repo && git checkout -q -b newbranch)
+ echo "modified alpha on branch" >$testroot/repo/alpha
+ git_commit "$testroot/repo" -m "committing alpha on newbranch"
+ echo "modified delta on branch" >$testroot/repo/gamma/delta
+ git_commit "$testroot/repo" -m "committing delta on newbranch"
+ # diverge from newbranch
+ (cd "$testroot/repo" && git checkout -q master)
+ echo "modified beta on master" >$testroot/repo/beta
+ git_commit "$testroot/repo" -m "committing zeto no master"
+
+ got checkout "$testroot/repo" "$testroot/wt" >/dev/null
+
+ # unset in a subshell to avoid affecting our environment
+ (unset GOT_IGNORE_GITCONFIG && cd $testroot/wt && \
+ got merge newbranch > /dev/null)
+
+ (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "from: Flan Luck <flan_luck@openbsd.org>" \
+ > $testroot/stdout.expected
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ fi
+ test_done "$testroot" "$ret"
+}
+
test_parseargs "$@"
run_test test_merge_basic
run_test test_merge_continue
run_test test_merge_imported_branch
run_test test_merge_interrupt
run_test test_merge_umask
+run_test test_merge_gitconfig_author