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

[StGit PATCH 3/5] Let some commands work with detached HEAD

From
Karl Hasselström <kha@treskal.com>
Date
Nov 11, 2007, 19:43 UTC
Message-ID
<20071111194349.18868.77565.stgit@yoghurt>
In-Reply-To
<20071111193545.18868.62490.stgit@yoghurt>

add, resolved, and status didn't use the crt_series that was initialized for them. So don't initialize it, since that means (1) less work and (2) they won't fail when HEAD is detached.

Note that this doesn't completely fix the problem with detached HEAD: a number of other commands (e.g. branch) don't always need to refer to a current series, but currently fails on a detached HEAD even in those situations.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 stgit/commands/add.py      |    2 +-
 stgit/commands/resolved.py |    2 +-
 stgit/commands/status.py   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/add.py b/stgit/commands/add.py
index 264ab9f..ceea188 100644
--- a/stgit/commands/add.py
+++ b/stgit/commands/add.py
@@ -31,7 +31,7 @@ Add the files or directories passed as arguments to the
 repository. When a directory name is given, all the files and
 subdirectories are recursively added."""
 
-directory = DirectoryHasRepository()
+directory = DirectoryHasRepository(needs_current_series = False)
 options = []
 
 
diff --git a/stgit/commands/resolved.py b/stgit/commands/resolved.py
index 236ffd7..011db91 100644
--- a/stgit/commands/resolved.py
+++ b/stgit/commands/resolved.py
@@ -34,7 +34,7 @@ Mark a merge conflict as resolved. The conflicts can be seen with the
 'C'. This command also removes any <file>.{ancestor,current,patched}
 files."""
 
-directory = DirectoryHasRepository()
+directory = DirectoryHasRepository(needs_current_series = False)
 options = [make_option('-a', '--all',
                        help = 'mark all conflicts as solved',
                        action = 'store_true'),
diff --git a/stgit/commands/status.py b/stgit/commands/status.py
index 5763d09..20614b0 100644
--- a/stgit/commands/status.py
+++ b/stgit/commands/status.py
@@ -40,7 +40,7 @@ under revision control. The files are prefixed as follows:
 A 'refresh' command clears the status of the modified, new and deleted
 files."""
 
-directory = DirectoryHasRepository()
+directory = DirectoryHasRepository(needs_current_series = False)
 options = [make_option('-m', '--modified',
                        help = 'show modified files only',
                        action = 'store_true'),
Previous: Karl HasselströmNext: Karl Hasselström
Message 4 of 8 in “A few small fixes”
  1. 0/5 A few small fixesKarl Hasselström, Nov 11, 2007
  2. 1/5 Simple test for "stg clean"Karl Hasselström, Nov 11, 2007
  3. 2/5 Cogito is deprecated, so don't point to itKarl Hasselström, Nov 11, 2007
  4. 3/5 Let some commands work with detached HEADKarl Hasselström, Nov 11, 2007
  5. 4/5 Rename "stg assimilate" to "stg repair"Karl Hasselström, Nov 11, 2007
  6. 5/5 stg repair: Patchify non-patch commits between patchesKarl Hasselström, Nov 11, 2007
  7. Catalin MarinasNov 12, 2007
  8. Karl HasselströmNov 12, 2007

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.