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

[StGIT PATCH 2/5] Rename Repository.head to Repository.head_ref

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Jun 4, 2008, 21:13 UTC
Message-ID
<20080604211325.32531.84968.stgit@localhost.localdomain>
In-Reply-To
<20080604210655.32531.82580.stgit@localhost.localdomain>

This is to avoid confusion with the Stack.head function which returns a commit object rather than a file name. The patch also changes the "new" function to use stack.head directly rather than via the Repository.refs... object.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/new.py |    3 +--
 stgit/lib/git.py      |    4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/stgit/commands/new.py b/stgit/commands/new.py
index 15bb2e0..c4ee4e1 100644
--- a/stgit/commands/new.py
+++ b/stgit/commands/new.py
@@ -58,9 +58,8 @@ def func(parser, options, args):
     else:
         parser.error('incorrect number of arguments')
 
-    head = directory.repository.refs.get(directory.repository.head)
     cd = gitlib.CommitData(
-        tree = head.data.tree, parents = [head], message = '',
+        tree = stack.head.data.tree, parents = [stack.head], message = '',
         author = gitlib.Person.author(), committer = gitlib.Person.committer())
 
     # Set patch commit message from commandline.
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index c9f01e3..fd66f6d 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -443,13 +443,13 @@ class Repository(RunWithEnv):
                                                 ).output_one_line()
         return self.get_commit(sha1)
     @property
-    def head(self):
+    def head_ref(self):
         try:
             return self.run(['git', 'symbolic-ref', '-q', 'HEAD']
                             ).output_one_line()
         except run.RunException:
             raise DetachedHeadException()
-    def set_head(self, ref, msg):
+    def set_head_ref(self, ref, msg):
         self.run(['git', 'symbolic-ref', '-m', msg, 'HEAD', ref]).no_output()
     def simple_merge(self, base, ours, theirs):
         """Given three L{Tree}s, tries to do an in-index merge with a
Previous: Catalin MarinasNext: Karl Hasselström
Message 5 of 28 in “Various updates to the new infrastructure”
  1. 0/5 Various updates to the new infrastructureCatalin Marinas, Jun 4, 2008
  2. 1/5 Allow stack.patchorder.all to return hidden patchesCatalin Marinas, Jun 4, 2008
  3. Karl HasselströmJun 5, 2008
  4. Catalin MarinasJun 5, 2008
  5. 2/5 Rename Repository.head to Repository.head_refCatalin Marinas, Jun 4, 2008
  6. Karl HasselströmJun 5, 2008
  7. Catalin MarinasJun 5, 2008
  8. Karl HasselströmJun 5, 2008
  9. Catalin MarinasJun 5, 2008
  10. Karl HasselströmJun 5, 2008
  11. 3/5 Create a git.Branch class as ancestor of stack.StackCatalin Marinas, Jun 4, 2008
  12. Karl HasselströmJun 5, 2008
  13. Catalin MarinasJun 5, 2008
  14. Karl HasselströmJun 5, 2008
  15. Catalin MarinasJun 6, 2008
  16. Karl HasselströmJun 7, 2008
  17. Catalin MarinasJun 8, 2008
  18. David AguilarJun 9, 2008
  19. Sverre RabbelierJun 9, 2008
  20. Karl HasselströmJun 9, 2008
  21. 4/5 Add stack creation and initialisation support to lib.StackCatalin Marinas, Jun 4, 2008
  22. Karl HasselströmJun 5, 2008
  23. Catalin MarinasJun 5, 2008
  24. Karl HasselströmJun 7, 2008
  25. 5/5 Add stack creation and deletion support to the new infrastructureCatalin Marinas, Jun 4, 2008
  26. Karl HasselströmJun 5, 2008
  27. Catalin MarinasJun 5, 2008
  28. Karl HasselströmJun 5, 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.