Skip to contentSkip to conversation

New git-seek command with documentation and test.

PATCH [email protected] 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

The annoying thing about temporary branch names like "bisect" and "seek" is that:
a) They clutter up the nae space available to the repository user. Users have to know that those are reserved names.
b) If a repository is cloned while they're in use, they might get into a "remotes" file, with even more confusing results.

This is somewhat heretical, but how about making a truly unnamed branch by having .git/HEAD *not* be a symlink, but rather hold a commit ID directly? It's already well established that files in the .git directory directly are strictly local to this working directory, so it seems a much better home for such temporary state.

Admittedly, this requires more invasive edits (particularly adding a third legitimate case to validate_symref()), but it seems to make more sense. And be ultimately simpler than workarounds for the above problems.

Just loosen the rules from ".git/HEAD must be a symlink" to ".git/HEAD must be a symlink before you can check in".

Yes, I know it's radical. At least I'm not questioning the power and efficacy of indulgences. :-)

#1 lore raw
Quoted 7 lines · [email protected] wrote:

The annoying thing about temporary branch names like "bisect" and "seek" is that:
a) They clutter up the nae space available to the repository user. Users have to know that those are reserved names.
b) If a repository is cloned while they're in use, they might get into a "remotes" file, with even more confusing results.

Quoted 6 lines

This is somewhat heretical, but how about making a truly unnamed branch by having .git/HEAD *not* be a symlink, but rather hold a commit ID directly? It's already well established that files in the .git directory directly are strictly local to this working directory, so it seems a much better home for such temporary state.

It might be easier to just reserve part of the namespace, e.g. ".bisect" and ".seek" instead.

-hpa

#2 lore raw
Quoted 9 lines · H. Peter Anvin
Quoted 7 lines · [email protected] wrote:

The annoying thing about temporary branch names like "bisect" and "seek" is that:
a) They clutter up the nae space available to the repository user. Users have to know that those are reserved names.
b) If a repository is cloned while they're in use, they might get into a "remotes" file, with even more confusing results.

Quoted 9 lines
Quoted 6 lines

This is somewhat heretical, but how about making a truly unnamed branch by having .git/HEAD *not* be a symlink, but rather hold a commit ID directly? It's already well established that files in the .git directory directly are strictly local to this working directory, so it seems a much better home for such temporary state.

It might be easier to just reserve part of the namespace, e.g. ".bisect" and ".seek" instead.

Ach, no. Not specific names. ^\.-.* would be acceptable, but I sometimes use '.name' or '-name' to mark a temporary branch. Making .- or some such reserved would perhaps make sense, but not with specific names.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#3 lore raw
In reply to [email protected]

Hi,

Quoted 2 lines · On Fri, 23 Feb 2006, [email protected] wrote:

This is somewhat heretical, but how about making a truly unnamed branch by having .git/HEAD *not* be a symlink, but rather hold a commit ID directly?

Not heretical. How do you intend to switch branches now? And how do you intend to record the starting point of git-seek to which you want to return to? All leads back to .git/HEAD pointing to a branch (or whatever you want to call it). And BTW, .git/HEAD is no symlink these days, but a symref.

Hth,
Dscho

#4 lore raw
Quoted 1 line

Not heretical. How do you intend to switch branches now?

Point .git/HEAD at the branch like usual.
.git/HEAD would not be a symref *only* when on the unnamed temporary branch (which doesn't accept commits).

Quoted 2 lines

And how do you intend to record the starting point of git-seek to which you want to return to?

Te same way it's done now for git-seek or git-bisect: by copying the old HEAD to a temporary location like .git/head-name.

Quoted 2 lines

All leads back to .git/HEAD pointing to a branch (or whatever you want to call it).

In the usual case, yes it should. Any time you want to be able to develop on a branch, you need .git/HEAD pointing to a branch. You only make it point to a commit directly is when exploring the history with no intention of developing from it.

(Note that you can easily change your mind with a simple "git checkout -b <branch>".)

Quoted 1 line

And BTW, .git/HEAD is no symlink these days, but a symref.

Yes, I'm sorry; I was just being lazy with my terminology.