emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-repository-version on MS-Windows


From: Eli Zaretskii
Subject: Re: emacs-repository-version on MS-Windows
Date: Sun, 16 Nov 2014 18:03:04 +0200

> From: Andreas Schwab <address@hidden>
> Cc: Eli Zaretskii <address@hidden>,  address@hidden
> Date: Sat, 15 Nov 2014 23:42:46 +0100
> 
> > The bzr version of this intentionally avoided calling external executables.
> > (Apparently not possible with git.)
> 
> You can do that with git as well, the repository structure is fully
> documented (gitrepository-layout(5)).  Of course, you have to be
> prepared to update the procedure in case of future extensions.

So is the following algorithm correct?

  . visit the file .git/HEAD
  . if the contents is a SHA1 checksum, we are done: return that SHA1
  . otherwise:
    . parse the contents of .git/HEAD that should have the form
      "ref: refs/heads/BRANCH" where BRANCH is the name of the active
      branch
    . try visiting the file .git/refs/heads/BRANCH
    . if the file exists, its contents should be the SHA1 checksum we
      are looking for
    . otherwise:
      . visit the file .git/packed-refs, whose contents should be
        lines of the form "SHA1 REF"
      . find the line in that file whose REF part is "refs/heads/BRANCH"
      . the SHA1 part of that line is the checksum we are looking for

Does this cover all the possible arrangements of the repository and
all the possible workflows?

Btw, I think the packed-refs part is unnecessary, since the active
branch will never be packed -- is that right?

Question: Can .git/HEAD specify a branch in refs/remotes/?  If so,
what do we do in the above algorithm? punt and return nil?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]