already downloaded files when yt-dlp or a special remote was used.
* addurl, importfeed: Added --raw-except option.
* stack.yaml: Update to lts-22.9 and use crypton.
+ * assistant, undo: When committing, let the usual git commit
+ hooks run.
-- Joey Hess <id@joeyh.name> Mon, 29 Jan 2024 15:59:33 -0400
import qualified Annex.Branch
import qualified Remote
import qualified Types.Remote as Remote
-import Annex.Hook
import qualified Git.Command
import qualified Git.LsFiles as LsFiles
import qualified Git.Branch
return $ "git-annex in " ++ maybe "unknown" fromUUIDDesc (M.lookup u m)
commitStaged :: Git.Branch.CommitMode -> String -> Annex Bool
-commitStaged commitmode commitmessage = do
- runAnnexHook preCommitAnnexHook
- mb <- inRepo Git.Branch.currentUnsafe
- let (getparent, branch) = case mb of
- Just b -> (Git.Ref.sha b, b)
- Nothing -> (Git.Ref.headSha, Git.Ref.headRef)
- parents <- maybeToList <$> inRepo getparent
- void $ inRepo $ Git.Branch.commit commitmode False commitmessage branch parents
- return True
+commitStaged commitmode commitmessage =
+ inRepo $ Git.Branch.commitCommand commitmode
+ (Git.Branch.CommitQuiet True)
+ [ Param "-m"
+ , Param commitmessage
+ ]
mergeLocal :: [Git.Merge.MergeConfig] -> SyncOptions -> CurrBranch -> CommandStart
mergeLocal mergeconfig o currbranch = stopUnless (notOnlyAnnex o) $
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2024-02-07T18:59:34Z"
+ content="""
+Re the default messages, let's just say that any choice git-annex makes
+about a default commit message will not be to some people's liking.
+
+Re the hook not being run, this is due to it using `git commit-tree`.
+As well as being used for commits to the git-annex branch, it's also
+used in a few other places, including `git-annex import`, and
+generating adjusted branches and view branches, and the assistant
+and `git-annex undo`.
+"""]]
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 2"""
+ date="2024-02-07T19:09:44Z"
+ content="""
+Git has two hooks, prepare-commit-msg and commit-msg. prepare-commit-msg
+is used prior to interactive editing of the commit message. Since these
+commits do not involve interactive editing, I don't think it
+necesarily makes sense for git-annex to use that hook.
+
+The commit-msg hook is simpler, and it would certianly be possible for
+git-annex to call it everywhere it does a `git commit-tree`.
+
+But if git-annex called either of these hooks, how is the hook supposed to
+know what is being committed? In the usual case, the hook
+is called with `GIT_INDEX_FILE` pointed at an index file that
+has been modified to include whatever is going to be in the commit
+(which may be different than what is staged in the index), and it knows
+that the working directory is being committed. So it can
+do things like `git diff --name-stage --cached` to get the files that
+are being committed, for example.
+
+In the git-annex case, `GIT_INDEX_FILE` is pointed at .git/annex/index
+when committing the git-annex branch. If a commit-msg hook uses
+`git diff --name-stage --cached`, it will diff from the working directory
+to new git-annex branch contents, which will not be a useful set of file changes
+to summarize in a commit message!
+
+Even if the hook somehow knows that the git-annex branch is being
+committed, the best it could do is diff from git-annex branch to
+`GIT_INDEX_FILE` and then it has a bunch of git-annex branch filenames
+that have changed, and is supposed to somehow generate a useful commit
+message from that. How?
+
+It seems more likely to me that you know that git-annex branch changes are
+associated with an operation, so you might commit with "added 57 photos"
+to the master branch, and then use the same message for the git-annex
+branch commit. annex.commitmessage seems to already cover that case though?
+"""]]
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2024-02-07T19:58:11Z"
+ content="""
+Irrespective of comment #2, I do think that it makes sense for the
+assistant and `git-annex undo`, when committing to the HEAD branch,
+to run all the usual commit hooks.
+
+Actually, I don't see any reason for those to not run `git commit`.
+It seems that the use of `git commit-tree` in those dates back to
+[[!commit 03932212ecb8940e0fe2dd09c04951990bc29422]] which involved
+direct mode.
+
+Fixed those to run commits in the usual way (though noninteractive).
+"""]]