Commit graph

119 commits

Author SHA1 Message Date
Joey Hess
40ec8a9726 Branch module complete
Refactored some code that it needs into GitRepo.
2011-06-21 17:52:39 -04:00
Joey Hess
7e7428f173 refactor 2011-06-21 16:08:09 -04:00
Joey Hess
d519bc7137 sped up git-union-merge
Avoided the slow git add, instead inject content directly into git and
populate the index all in one pass. Now this runs on my large real-world
repo in 10 seconds, which is acceptable.

Also lots of code cleanups.
2011-06-20 21:37:18 -04:00
Joey Hess
c835166a7c add git-union-merge
This is a new git subcommand, that does a generic union merge operation
between two refs, storing the result in a branch. It operates efficiently
without touching the working tree. It does need to write out a temporary
index file, and may need to write out some other temp files as well.

This could be useful for anything that stores data in a branch,
and needs to merge changes into that branch without actually checking the
branch out. Since conflict handling can't be done without a working copy,
the merge type is always a union merge, which is fine for data stored in
log format (as git-annex does), or in non-conflicting files
(as pristine-tar does).

This probably belongs in git proper, but it will live in git-annex for now.

---

Plan is to move .git-annex/ to a git-annex branch, and use git-union-merge
to handle merging changes when pulling from remotes.

Some preliminary benchmarking using real .git-annex/ data indicates
that it's quite fast, except for the "git add" call, which is as slow
as "git add" tends to be with a big index.
2011-06-20 21:37:18 -04:00
Joey Hess
5b941980aa Closer emulation of git's behavior when told to use "foo/.git" as a git repository instead of just "foo". Closes: #627563 2011-05-22 14:12:16 -04:00
Joey Hess
21d9c84e72 more standard names for whenM and unlessM operators
These are defined in ifelse, but it's not currently available and I don't
want to pull in a library for 6 lines of code anyhow.

Also, ifelse sets the fixity to 1, which does not allow >>? error $ ...
2011-05-17 11:45:24 -04:00
Joey Hess
c91929f693 add whenM and unlessM
Just more golfing.. I am pretty sure something in a library somewhere can
do this, but I have been unable to find it.
2011-05-17 03:13:11 -04:00
Joey Hess
760cde28b6 more pointless monadic golfing 2011-05-16 14:49:28 -04:00
Joey Hess
3e15a8a791 Maybe reduction pass 2 2011-05-15 12:25:58 -04:00
Joey Hess
cad0e1c8b7 simplified a bunch of Maybe handling 2011-05-15 03:38:08 -04:00
Joey Hess
078a6fbd76 Work around a bug in Network.URI's handling of bracketed ipv6 addresses. 2011-05-06 15:21:30 -04:00
Joey Hess
7a33803193 Avoid pipeline stall when running git annex drop or fsck on a lot of files.
When it's stalled, there are 3 processes:

git annex
  git ls-files
  git check-attr

git-annex stalls trying to write to git check-attr, which stalls trying to
write to stdout (read by git-annex).

git ls-files does not seem to be involved directly; I've seen the stall when
it was still streaming out the file list, and after it had exited and
zombified.

The read and write are supposed to be handled by two different threads,
which pipeBoth forks off, thus avoiding deadlock. But it does deadlock.
(Certian signals unblock the deadlock for a while, then it stalls again.)

So, this is another case of WTF is the ghc IO manager doing today?
I avoid the issue by converting the writer to a separate process.

Possibly this was caused by some change in ghc 7 -- I'm offline and cannot
verify now, but I'm sure I used to be able to run git annex drop w/o it
hanging! And the code does not seem to have changed, except for commit
c1dc407941, which I tried reverting without
success. In fact, I reverted all the way back to 0.20110316 and still
saw the stall.

Update: Minimal test case:

import System.Cmd.Utils

main = do
	as <- checkAttr "blah" $ map show [1..100000]
	sequence $ map (putStrLn . show) as

checkAttr attr files = do
	(_, s) <- pipeBoth "git" params $ unlines files
	return $ lines s
	where
		params = ["check-attr", attr, "--stdin"]

Bug filed on ghc in debian, #624389
2011-04-27 23:18:35 -04:00
Joey Hess
76911a446a Avoid using absolute paths when staging location log, as that can confuse git when a remote's path contains a symlink. Closes: #621386
This was a real PITA to fix, since location logs can be staged in
both the current repo, as well as in local remote's repos, in
which case the cwd will not be in the repo. And git add needs different
params in both cases, when absolute paths are not used.

In passing, git annex fsck now stages location log fixes.
2011-04-25 14:54:24 -04:00
Joey Hess
b0b413c69f fix relative
Not currently used, but was buggy.
2011-04-25 13:02:54 -04:00
Joey Hess
141e55ff11 store annex.uuid in bup repos 2011-04-09 12:34:49 -04:00
Joey Hess
6b5918c295 some reorg and further remote generalization 2011-03-27 21:43:25 -04:00
Joey Hess
7051763b5b tweak 2011-03-22 21:00:18 -04:00
Joey Hess
c1dc407941 Fix space leak in fsck and drop commands.
The space leak was somehow caused by this line:

	absfiles <- mapM absPath files

I confess, I don't quite understand why this caused bad buffering,
but apparently the whole pipeline from git-ls-files backed up at that
point.

Happily, rewriting the code to only get the cwd once and use a pure
function to calculate absfiles clears it up, and should be a little more
efficient in syscalls too.
2011-03-22 20:31:22 -04:00
Joey Hess
0663f14cf7 Fix support for remotes with '.' in their names. 2011-03-18 16:29:42 -04:00
Joey Hess
acde7a1736 improve GitRepos functions for pulling apart URL to repo 2011-03-05 15:13:16 -04:00
Joey Hess
14e0d01b58 remove debugging printf 2011-03-03 21:19:01 -04:00
Joey Hess
42259eee92 support git funky remote syntaxes
* Look for dir.git directories the same as git does.
* Support remote urls specified as relative paths.
* Support non-ssh remote paths that contain tilde expansions.
2011-03-03 21:02:29 -04:00
Joey Hess
b27b0d5cd4 remove unused code 2011-03-03 17:35:44 -04:00
Joey Hess
e49e6a403b avoid failing if a local repo is not currently available
The added check if a repo is bare means its config needs to be read, but
in this case it cannot be. That means that a repo currently not available
is assumed to be non-bare.
2011-03-03 17:33:15 -04:00
Joey Hess
d651d4985b some initial support for local bare repos
This relies on git-annex's behavior of reading the config of local repos.
That allows repoIsLocalBare to examine the git config for core.bare.

Hopefully, gitAnnexLocation, gitAnnexDir, and gitAnnexObjectDir
are only used on local repos. But, I have not audited fully, since
they're probably not (see for example copyToRemote). And so,
the functions fall back to their old non-bare-aware behavior for
non-local repos.
2011-03-03 14:51:57 -04:00
Joey Hess
4cd96ad2db rename 2011-02-28 16:25:31 -04:00
Joey Hess
fcdc4797a9 use ShellParam type
So, I have a type checked safe handling of filenames starting with dashes,
throughout the code.
2011-02-28 16:18:55 -04:00
Joey Hess
c319a336a3 Fix test suite to reap zombies.
I had not taken into account that the code was written to run git and leave
zombies, for performance/laziness reasons, when I wrote the test suite.
So rather than the typical 1 zombie process that git-annex develops, test
developed dozens. Caused problems on system with low process limits.
Added a reap function to GitRepo, that waits for any zombie child processes.
2011-02-13 00:50:09 -04:00
Joey Hess
ef2d4f650e fix absrepo data loss
it was dropping the config map for the repos it changed
2011-02-04 01:56:45 -04:00
Joey Hess
17829be0fd map improvements
added uuid.log repos

group repos by host

avoid displaying most urls

display remote names on edges

still some bugs
2011-02-03 22:20:55 -04:00
Joey Hess
14bc885de9 more accessor functions and better bad url handling 2011-02-03 18:47:14 -04:00
Joey Hess
0e7984a793 add check for unclean tree 2011-02-01 22:02:19 -04:00
Joey Hess
4f9336bb60 idiom 2011-01-27 17:58:30 -04:00
Joey Hess
a8ce30401d add checks that location log files are committed
currently failing for move --to
2011-01-11 16:00:40 -04:00
Joey Hess
c2b13a88bf use concat 2011-01-09 18:23:58 -04:00
Joey Hess
14fe13dc2b support ssh urls containing "~", and relative user:path 2010-12-31 21:22:03 -04:00
Joey Hess
eac433a84a use git-annex-shell configlist 2010-12-31 15:46:33 -04:00
Joey Hess
022e0c7751 Support scp-style urls for remotes (host:path). 2010-12-28 13:48:11 -04:00
Joey Hess
346c7a0257 Avoid multiple calls to git ls-files when passed eg, "*". 2010-12-23 21:58:58 -04:00
Joey Hess
5d4052d0e0 Support remotes using git+ssh and ssh+git as protocol. Closes: #607056 2010-12-14 12:46:09 -04:00
Joey Hess
5ec3cea059 Support remotes using git+ssh:// as protocol. Closes: #607056 2010-12-14 11:37:11 -04:00
Joey Hess
abf084f628 Bugfix: Always correctly handle gitattributes when in a subdirectory of the repository. 2010-11-28 17:17:18 -04:00
Joey Hess
57adb0347b hlint tweaks
Remotes.hs next, and also Backend/* and Command/*
2010-11-22 15:46:57 -04:00
Joey Hess
f2c7a6e73d got rid of several more calls to git when finding unlocked files 2010-11-11 18:21:54 -04:00
Joey Hess
81524d19a7 add typeChangedFiles 2010-11-10 14:01:41 -04:00
Joey Hess
a3519c365f hlinted a few files 2010-11-06 17:07:11 -04:00
Joey Hess
d93a372894 add a stupid test harness 2010-11-02 16:49:35 -04:00
Joey Hess
c7b0f60fba clean up 2010-11-02 16:02:43 -04:00
Joey Hess
cecb1cbeb2 clean up 2010-11-02 16:00:55 -04:00
Joey Hess
9e5985ff98 blew several hours on getting the decodeGitFile 100% right with quickcheck 2010-11-02 15:54:43 -04:00