Re: [PATCH 3/5] sequencer: sequencer state is useless without todo

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

 



Ramkumar Ramachandra wrote:

> Later in the series, we will not write '.git/sequencer/todo' for a
> single commit cherry-pick, because 'CHERRY_PICK_HEAD' already contains
> this information.  So, stomp the sequencer state in create_seq_state()
> unless the todo file is present.

What problem does this solve?  How does it solve it?  What does it
mean to stomp?

The usual commit-message debugging strategy applies here: imagine you
are a BIOS clone manufacturer, and for legal reasons you are not
allowed to read this part of the git implementation embedded in the
standard BIOS.  However, you are allowed to read the commit message,
and if that message is clear enough, it will explain the purpose and
behavior of that code and you will be able to implement a compatible
implementation addressing the same problem without scratching your
head too much.

> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -654,11 +654,15 @@ static void walk_revs_populate_todo(struct replay_insn_list **todo_list,
>  
>  static int create_seq_dir(void)
>  {
> +	const char *todo_file = git_path(SEQ_TODO_FILE);
>  	const char *seq_dir = git_path(SEQ_DIR);

Scary idiom.

> -	if (file_exists(seq_dir))
> -		return error(_("%s already exists."), seq_dir);
> -	else if (mkdir(seq_dir, 0777) < 0)
> +	if (file_exists(todo_file))
> +		return error(_("%s already exists."), todo_file);
> +
> +	/* If todo_file doesn't exist, discard sequencer state */
> +	remove_sequencer_state(1);
> +	if (mkdir(seq_dir, 0777) < 0)
>  		die_errno(_("Could not create sequencer directory '%s'."), seq_dir);

I guess this patch would make more sense after patch 4.
--
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]