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

Re: [PATCH] Fix default pull not to do an unintended Octopus.

From
JWJosef Weidendorfer <josef.weidendorfer@gmx.de>
Date
Sep 27, 2005, 09:52 UTC
Message-ID
<200509271152.42963.Josef.Weidendorfer@gmx.de>
In-Reply-To
<7vu0g72c4y.fsf_-_@assigned-by-dhcp.cox.net>
On Tuesday 27 September 2005 09:38, Junio C Hamano wrote:
Show 6 quoted lines
> I think it could be modified without too much pain to take
> "which heads to use for merge by default" information from
> separate "Merge: " line as Jon proposed, if enough people like
> that idea better.  Personally I do not think it would make much
> practical difference from the end users' point of view, but I've
> been proven wrong more often than not in the past, so...

Hmm... What is the "intuitive" thing a user would expect when looking at a remotes file? It looks like including lists of default heads which are used for git commands when no further head is specified, i.e. which are automatically appended to the command line.

E.g. with .git/remotes/remoterep looking like
	URL: ...
	Pull: local1:remote1 local2:remote2
	Push: local3:remote3 local4:remote4
a
	git push remoterep
expands to (AFAIK)
	git push remoterep local3:remote3 local4:remote4
So for
	git pull remoterep
the expected command seems to be
	git pull local1:remote1 local2:remote2

and of course this does an octopus merge at the end. It may be a strange thing to do, but if the user does *not* want to do octopus merges, he probably only will give one default head in the Pull line of the remotes file.

So I would not change the current behavior.

It seems better to me to support an additional "Fetch:" line. IMHO, a "Merge:" lines does not make sense, as "git merge" has nothing to do with remote repositories at all [I just looked up the man page of git-merge, and confusingly it talks about "remotes", which are in fact local heads to be merged].

> As Pasky said in another thread, git-fetch is not the most
> elegantly written script on earth, and it is not my favorite
> script either -- it needs to do complex things, like interacting
> with the later git-pull stage.

Like Pasky, I am not really comfortable with this remotes stuff. AFAIK, it was introduced to shorten some command line by providing defaults (to be used by the "GIT core porcelain"). But I still have to provide the remote shortcut on the command line.

As Cogito does, I expect the porcelain to store the mapping of a local head to a remote head, automatically using the right remote repository.

I want to type "git fetch maint" to get the maintanance branch of git, and not specify an additionally introduced arbitrary short name for the remote git repo (which is used quite less often than my head names: heads appear in gitk, I switch among heads...). And using the same name for a remote shortcut and a local head can confuse people.

So IMHO default actions should be stored for branches, not for shortcuts of remote positions. The branches stuff matches this better, as one file in branches/ corresponds exactly to one head with the same name, and specifies the attributes "remote repository" and "remote head".

This also shortens command lines much better then the remotes stuff, as you implicity specify a default head: The one you are on.

Perhaps we should have extended the branches file to allow different remote reps and heads depending on the command (fetch/pull/merge/push). A "URL:" is not needed, as you probably like to have different repos for pull and push. And in contrast to the remotes stuff above, a "Merge:" line makes quite sense here: When on "mybranch", a merge should default to merging the heads specified on the Merge line in branches/mybranch.

When cloning a remote head, Cogito creates a local "origin" head and corresponding mapping in branches/origin. Afterwards, it automatically generates a new local branch "master", which branches of at the origin. Further "cg-updates" (=git fetch+merge) fetch origin, and merge origin into master. I assume that this currently is hardcoded in scripts? Shouldn't there be created a branches/master, specifying that a default merge should happen with "origin"? This way, an "cg-update" would look into "branches/master" on the "Merge:" line. It sees that "origin" is bound to a remote head, and thus, does a fetch before merging.

Opinions?
Josef
Previous: Junio C HamanoNext: Petr Baudis
Message 18 of 23 in “GIT 0.99.7d, and end of week status.”
  1. Junio C HamanoSep 25, 2005
  2. Alan ChandlerSep 25, 2005
  3. Junio C HamanoSep 25, 2005
  4. Alan ChandlerSep 25, 2005
  5. Junio C HamanoSep 26, 2005
  6. Alan ChandlerSep 26, 2005
  7. Junio C HamanoSep 26, 2005
  8. Tom PrinceSep 25, 2005
  9. Junio C HamanoSep 25, 2005
  10. Petr BaudisSep 26, 2005
  11. Junio C HamanoSep 26, 2005
  12. Petr BaudisSep 27, 2005
  13. Matthias UrlichsSep 29, 2005
  14. Junio C HamanoSep 29, 2005
  15. Jon LoeligerSep 26, 2005
  16. Junio C HamanoSep 26, 2005
  17. Fix default pull not to do an unintended Octopus.Junio C Hamano, Sep 27, 2005
  18. Josef WeidendorferSep 27, 2005
  19. Petr BaudisSep 27, 2005
  20. Josef WeidendorferSep 27, 2005
  21. Junio C HamanoSep 27, 2005
  22. Petr BaudisSep 27, 2005
  23. Petr BaudisSep 27, 2005

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.