commit - 7e33c8c53ef5e4d67f3fe59f5f2331ef875e6d53
commit + 5175b31a9e97f249cc1e6621f50d05b3c3dca974
blob - ce6e873bbca21232e04564bbc51942ed40881e96
blob + a205e68a8f5538b8bd7db5bcec9ce4423a58ed62
--- lib/commit_graph.c
+++ lib/commit_graph.c
return err;
}
+ if (graph->iter_node == NULL) {
+ const char *path;
+ if (got_path_is_root_dir(graph->path))
+ return got_error_no_obj(id);
+ path = graph->path;
+ while (path[0] == '/')
+ path++;
+ return got_error_path(path, GOT_ERR_NO_TREE_ENTRY);
+ }
+
return NULL;
}
blob - 8e9f809ace46ce020fcc892284d45c339bea795e (mode 755)
blob + f4d399731833a0602d264e4b23b63048d5d8c826 (mode 744)
--- regress/cmdline/log.sh
+++ regress/cmdline/log.sh
test_done "$testroot" "0"
}
+function test_log_nonexistent_path {
+ local testroot=`test_init log_nonexistent_path`
+ local head_rev=`git_show_head $testroot/repo`
+
+ echo "commit $head_rev (master)" > $testroot/stdout.expected
+
+ (cd $testroot/repo && got log this/does/not/exist \
+ > $testroot/stdout 2> $testroot/stderr)
+ ret="$?"
+ if [ "$ret" == "0" ]; then
+ echo "log command succeeded unexpectedly" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
+
+ echo -n > $testroot/stdout.expected
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "got: this/does/not/exist: no such entry found in tree" \
+ > $testroot/stderr.expected
+ cmp -s $testroot/stderr.expected $testroot/stderr
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stderr.expected $testroot/stderr
+ fi
+ test_done "$testroot" "$ret"
+}
+
run_test test_log_in_repo
run_test test_log_in_bare_repo
run_test test_log_in_worktree
run_test test_log_in_worktree_with_path_prefix
run_test test_log_tag
run_test test_log_limit
+run_test test_log_nonexistent_path