git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin-commit: avoid always using reduce_heads()

From
Shawn O. Pearce <spearce@spearce.org>
Date
Sep 26, 2008, 15:52 UTC
Message-ID
<20080926155204.GD17584@spearce.org>
In-Reply-To
<1222442432-7430-1-git-send-email-vmiklos@frugalware.org>
Miklos Vajna <vmiklos@frugalware.org> wrote:
> In case git merge --no-ff is used with --no-commit or we have a
> conflict, write info about if fast forwards are allowed or not to
> $GIT_DIR/MERGE_MODE.
Show 16 quoted lines
> diff --git a/builtin-commit.c b/builtin-commit.c
> index 55e1087..aac5cb4 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -988,7 +990,18 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>  		reflog_msg = "commit";
>  		pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
>  	}
> -	parents = reduce_heads(parents);
> +	strbuf_reset(&sb);
> +	if (!stat(git_path("MERGE_MODE"), &statbuf)) {
> +		if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
> +			die("could not read MERGE_MODE: %s", strerror(errno));
> +		printf("debug, contents of buf: '%s'\n",sb.buf);
> +		if (!strcmp(sb.buf, "deny_fast_forward")) {
> +			printf("debug, deny fast forward\n");
Left over debugging.
Show 14 quoted lines
> diff --git a/builtin-merge.c b/builtin-merge.c
> index 5c65a58..973b167 100644
> --- a/builtin-merge.c
> +++ b/builtin-merge.c
> @@ -1210,6 +1210,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>  			merge_msg.len)
>  			die("Could not write to %s", git_path("MERGE_MSG"));
>  		close(fd);
> +		fd = open(git_path("MERGE_MODE"), O_WRONLY | O_CREAT, 0666);
> +		if (fd < 0)
> +			die("Could open %s for writing", git_path("MERGE_MODE"));
> +		strbuf_reset(&buf);
> +		if (!allow_fast_forward)
> +			strbuf_addf(&buf, "deny_fast_forward");

I wonder if the option in the file shouldn't be more related to the merge command line option. Its --no-ff to the user. Maybe we should call it "no-ff" here? Or "no-fast-forward" if we want to go with a longer name that is less likely to be ambiguous in the future?

-- 
Shawn.
Previous: Miklos VajnaNext: Miklos Vajna
Message 7 of 22 in “[BUG] merge --no-ff --no-commit && commit”
  1. SZEDER GáborSep 25, 2008
  2. builtin-commit: avoid using reduce_heads()Miklos Vajna, Sep 26, 2008
  3. SZEDER GáborSep 26, 2008
  4. Miklos VajnaSep 26, 2008
  5. Miklos VajnaSep 26, 2008
  6. builtin-commit: avoid always using reduce_heads()Miklos Vajna, Sep 26, 2008
  7. Shawn O. PearceSep 26, 2008
  8. builtin-commit: avoid always using reduce_heads()Miklos Vajna, Sep 26, 2008
  9. Shawn O. PearceOct 3, 2008
  10. builtin-commit: avoid always using reduce_heads()Miklos Vajna, Oct 3, 2008
  11. Shawn O. PearceOct 3, 2008
  12. builtin-commit: avoid always using reduce_heads()Miklos Vajna, Oct 5, 2008
  13. Shawn O. PearceOct 6, 2008
  14. builtin-commit: use reduce_heads() only when appropriateSZEDER Gábor, Oct 3, 2008
  15. Miklos VajnaOct 5, 2008
  16. Jakub NarebskiSep 26, 2008
  17. Miklos VajnaSep 26, 2008
  18. Jakub NarebskiSep 26, 2008
  19. Miklos VajnaSep 29, 2008
  20. Miklos VajnaSep 29, 2008
  21. Jakub NarebskiSep 29, 2008
  22. SZEDER GáborSep 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.