Re: [PATCH v3 2/7] cherry-pick: treat CHERRY_PICK_HEAD and REVERT_HEAD as refs

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

 



David Turner <dturner@xxxxxxxxxxxxxxxx> writes:

> Instead of directly writing to and reading from files in
> $GIT_DIR, use ref API to interact with CHERRY_PICK_HEAD
> and REVERT_HEAD.
> ...
> diff --git a/sequencer.c b/sequencer.c
> index f8421a8..de904aa 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -160,19 +160,20 @@ static void free_message(struct commit *commit, struct commit_message *msg)
>  
>  static void write_cherry_pick_head(struct commit *commit, const char *pseudoref)

I guess this is no longer "pseudoref"?

> @@ -878,8 +879,8 @@ static int rollback_single_pick(void)
>  {
>  	unsigned char head_sha1[20];
>  
> -	if (!file_exists(git_path("CHERRY_PICK_HEAD")) &&
> -	    !file_exists(git_path("REVERT_HEAD")))
> +	if (read_ref("CHERRY_PICK_HEAD", head_sha1) &&
> +	    read_ref("REVERT_HEAD", head_sha1))
>  		return error(_("no cherry-pick or revert in progress"));
>  	if (read_ref_full("HEAD", 0, head_sha1, NULL))
>  		return error(_("cannot resolve HEAD"));

I would have expected that you would use ref_exists() here; you are
not reading "HEAD" yet writing it into head_sha1[], and not using
the value of the ref.

Other than that, looked very sensible.  Thanks.


--
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]