diff options
author | Kyle Meyer <kyle@kyleam.com> | 2019-04-09 19:07:37 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-10 12:52:50 +0900 |
commit | f937bc2f86ba2c2956b4228bd2386aaafc9afe83 (patch) | |
tree | fa4e2f9e2fd08ab635b2eaede283bc8b649ee900 /wt-status.c | |
parent | dir: do not traverse repositories with no commits (diff) | |
download | tgif-f937bc2f86ba2c2956b4228bd2386aaafc9afe83.tar.xz |
add: error appropriately on repository with no commits
The previous commit made 'git add' abort when given a repository that
doesn't have a commit checked out. However, the output upon failure
isn't appropriate:
% git add repo
warning: adding embedded git repository: repo
hint: You've added another git repository inside your current repository.
hint: [...]
error: unable to index file 'repo/'
fatal: adding files failed
The hint doesn't apply in this case, and the error message doesn't
tell the user why 'repo' couldn't be added to the index.
Provide better output by teaching add_to_index() to error when given a
git directory where HEAD can't be resolved. To avoid the embedded
repository warning and hint, call check_embedded_repo() only after
add_file_to_index() succeeds because, in general, its output doesn't
make sense if adding to the index fails.
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
0 files changed, 0 insertions, 0 deletions