Re: [PATCHv9 4/4] status: better advices when splitting a commit (during rebase -i)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 7, 2012, 18:07 UTC
- Message-ID
- <7vpq9bgfne.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1339075029-27109-4-git-send-email-Lucien.Kong@ensimag.imag.fr>
Lucien Kong <Lucien.Kong@ensimag.imag.fr> writes:
Show 7 quoted lines
> +static int split_commit_in_progress(struct wt_status *s)
> +{
> + int split_in_progress = 0;
> + const char *head = read_line_from_git_path("HEAD");
> + const char *orig_head = read_line_from_git_path("ORIG_HEAD");
> + const char *rebase_amend = read_line_from_git_path("rebase-merge/amend");
> + const char *rebase_orig_head = read_line_from_git_path("rebase-merge/orig-head");By declaring these newly allocated memory you own in this function and free() yourself as "const char *", the only thing you are gaining is the need to cast constness away when you call free().
Why are these necessary?
> + if (!head || !orig_head || !rebase_amend || > + !rebase_orig_head || !prefixcmp(head, "refs/heads/")) > + return split_in_progress;
Can't .git/HEAD be a symlinked symref?