This commit is contained in:
Joey Hess 2015-07-03 14:07:40 -04:00
parent 9ba9d16352
commit e54da868ac

View file

@ -0,0 +1,67 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2015-07-03T17:59:39Z"
content="""
I am reluctant to make direct mode grow to replicate significant (and
really quite complex) git commands like commit. Which is why I have not
added this.
`git annex proxy` brings a lot of regular git commands to
direct mode.
It's possible to use it to make a commit in direct mode. You only have
to manually `git annex add` the modified files first, to get them staged
in the index.
joey@darkstar:~/tmp/a>date > newfile
joey@darkstar:~/tmp/a>echo modified > foo
joey@darkstar:~/tmp/a>git annex add newfile foo
add newfile ok
add foo ok
(recording state in git...)
joey@darkstar:~/tmp/a>git annex proxy -- git commit foo -m foo
ok
(recording state in git...)
[annex/direct/master 739c518] foo
1 file changed, 1 insertion(+), 1 deletion(-)
joey@darkstar:~/tmp/a>git show
commit 739c518997cc9d0a21e920213394079fce9e7a11
Author: Joey Hess <joeyh@joeyh.name>
Date: Fri Jul 3 14:04:19 2015 -0400
foo
diff --git a/foo b/foo
index 4925a0e..0f22f36 120000
--- a/foo
+++ b/foo
@@ -1 +1 @@
-.git/annex/objects/fV/Zq/SHA256E-s30--79d01999a1e7d689136859f7462651dbe179b9c779c45d4e0b2815f426628b75/SHA256E-s30--79d01999a1e7d689136859f7462651dbe179b9c779c45d4e0b2815f426628b75
\ No newline at end of file
+.git/annex/objects/qw/8m/SHA256E-s9--4487e24377581c1a43c957c7700c8b49920de7b8500c05590cee74996ef73f42/SHA256E-s9--4487e24377581c1a43c957c7700c8b49920de7b8500c05590cee74996ef73f42
\ No newline at end of file
joey@darkstar:~/tmp/a>git annex proxy -- git commit -a -m added\ newfile
ok
[annex/direct/master 9abe7a4] added newfile
1 file changed, 1 insertion(+)
create mode 120000 newfile
joey@darkstar:~/tmp/a>git show
commit 9abe7a4fa083ea0e4529df0054f44f4e30d9e0ae
Author: Joey Hess <joeyh@joeyh.name>
Date: Fri Jul 3 14:04:38 2015 -0400
added newfile
diff --git a/newfile b/newfile
new file mode 120000
index 0000000..1bb8d0d
--- /dev/null
+++ b/newfile
@@ -0,0 +1 @@
+.git/annex/objects/23/q9/SHA256E-s30--42fb3eaea7c7932a9056e531f764ca83d117c69c79d4458f9860c6e525f8e498/SHA256E-s30--42fb3eaea7c7932a9056e531f764ca83d117c69c79d4458f9860c6e525f8e498
\ No newline at end of file
This works because `git annex proxy` sets up a temporary work tree,
using the content of the index. So you can commit any/all staged files.
"""]]