Re: [PATCHv9 4/4] status: better advices when splitting a commit (during rebase -i)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lucien Kong <Lucien.Kong@xxxxxxxxxxxxxxx> writes:

> +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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]