{"thread":{"id":"38280","subject":"profile-fast is failing in my Git 2.2.1 build from tar in a Git repo","startedAt":"2015-01-04T21:58:43Z","lastAt":"2015-01-12T21:16:05Z","messageCount":4,"participants":["Paul Smith","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"254280","messageId":"1420408723.7095.207.camel@homebase","threadId":"38280","inReplyTo":null,"subject":"profile-fast is failing in my Git 2.2.1 build from tar in a Git repo","fromName":"Paul Smith","fromEmail":"paul@mad-scientist.net","sentAt":"2015-01-04T21:58:43Z","receivedAt":"2015-01-04T21:58:43Z","isPatch":false,"sender":{"key":"paul@mad-scientist.net","avatar":"https://avatars.githubusercontent.com/u/109636?v=4"},"body":"Is anyone aware of this?  It seems that profile-fast fails when invoked\nfrom a downloaded tarball, if you are in a Git repository when you\nunpack it.\n\nSo, for example, I have:\n\n  $ cd $HOME/src\n  $ git status\n  On branch master\n  Your branch is up-to-date with 'origin/master'.\n\n(this is NOT the Git source repo, this is my personal repo containing\nscripts used to build various source packages)\n\nThen I download git-2.2.1.tar.xz, unpack it, configure, and run \"make\nprofile-fast\".\n\nAfter it builds everything it starts trying to run the tests, and the\nt/perf/run script fails (I added some -x flags in the scripts):\n\n  === Running 9 tests in this tree ===\n  cp: cannot stat '/home/psmith/src/git-2.2.1/t/..//home/psmith/src/.git/objects': No such file or directory\n  error: failed to copy repository '/home/psmith/src/git-2.2.1/t/..' to '/home/psmith/src/git-2.2.1/t/perf/trash directory.p0000-perf-lib-sanity'\n\nThe problem is in the t/perf/perf-lib.sh:test_perf_create_repo_from()\nfunction, where we see this:\n\n  repo=\"$1\"\n  source=\"$2\"\n  source_git=$source/$(cd \"$source\" && git rev-parse --git-dir)\n\nThe function is invoked as:\n\n  test_perf_create_repo_from '/home/psmith/src/git-2.2.1/t/perf/trash directory.p5302-pack-index' /home/psmith/src/git-2.2.1/t/..\n\nbut this doesn't work, because \"$source\" is not a Git repository; it's\nthe root of the unpacked tarball.  But when we run \"git rev-parse\" in\nit, it finds the parent Git directory ($HOME/git) and uses that, so the\nvalue of source_git becomes:\n\n  /home/psmith/src/git-2.2.1/t/..//home/psmith/src/.git/objects\n\nwhich is obviously invalid.  I think you want source_git to be set\nsomething like this:\n\n  source_git=$(cd \"$source\" && git rev-parse --git-dir || echo \"$source\")\n\ninstead.  There are other ways to do this of course, but this worked for\nme... basically we want to use either git rev-parse OR $source but not\nboth.  I think...?\n"},{"id":"254379","messageId":"xmqq1tn7o63p.fsf@gitster.dls.corp.google.com","threadId":"38280","inReplyTo":"1420408723.7095.207.camel@homebase","subject":"Re: profile-fast is failing in my Git 2.2.1 build from tar in a Git repo","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-01-06T23:13:30Z","receivedAt":"2015-01-06T23:13:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Smith <paul@mad-scientist.net> writes:\n\n> Is anyone aware of this?  It seems that profile-fast fails when invoked\n> from a downloaded tarball, if you are in a Git repository when you\n> unpack it.\n\nNot me (I don't do profile build), but I am not surprised.\n\n> The problem is in the t/perf/perf-lib.sh:test_perf_create_repo_from()\n> function, where we see this:\n>\n>   repo=\"$1\"\n>   source=\"$2\"\n>   source_git=$source/$(cd \"$source\" && git rev-parse --git-dir)\n>\n> The function is invoked as:\n>\n>   test_perf_create_repo_from '/home/psmith/src/git-2.2.1/t/perf/trash\n> directory.p5302-pack-index' /home/psmith/src/git-2.2.1/t/..\n>\n> but this doesn't work, because \"$source\" is not a Git repository; it's\n> the root of the unpacked tarball.\n\nYup, that is exactly why I said I am not surprised.\n\nI do not think profile build is prepared to be run without having\nour history (after all, it is not test_perf_create_REPO_from, not\ntest_perf_create_source_directory_of_git_from).  It wants to create\na repository that hosts a reasonably sized but not too big a\nproject, i.e. us.\n\nThe safest and cleanest fix would be to make sure that the said\nfunction checks if $source/.git is a repository, perhaps?\n"},{"id":"254561","messageId":"20150112210827.GA10409@peff.net","threadId":"38280","inReplyTo":"xmqq1tn7o63p.fsf@gitster.dls.corp.google.com","subject":"Re: profile-fast is failing in my Git 2.2.1 build from tar in a Git repo","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-01-12T21:08:28Z","receivedAt":"2015-01-12T21:08:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 06, 2015 at 03:13:30PM -0800, Junio C Hamano wrote:\n\n> > The problem is in the t/perf/perf-lib.sh:test_perf_create_repo_from()\n> > function, where we see this:\n> >\n> >   repo=\"$1\"\n> >   source=\"$2\"\n> >   source_git=$source/$(cd \"$source\" && git rev-parse --git-dir)\n> >\n> > The function is invoked as:\n> >\n> >   test_perf_create_repo_from '/home/psmith/src/git-2.2.1/t/perf/trash\n> > directory.p5302-pack-index' /home/psmith/src/git-2.2.1/t/..\n> >\n> > but this doesn't work, because \"$source\" is not a Git repository; it's\n> > the root of the unpacked tarball.\n> \n> Yup, that is exactly why I said I am not surprised.\n> \n> I do not think profile build is prepared to be run without having\n> our history (after all, it is not test_perf_create_REPO_from, not\n> test_perf_create_source_directory_of_git_from).  It wants to create\n> a repository that hosts a reasonably sized but not too big a\n> project, i.e. us.\n> \n> The safest and cleanest fix would be to make sure that the said\n> function checks if $source/.git is a repository, perhaps?\n\nHmph. We already dealt with this once in 93b5393 (Makefile: make perf\ntests optional for profile build, 2014-08-19). That check explicitly\nlooks for \".git\" (and not checking that we are in an outer git repo), so\nI am not sure why it is kicking in at all. But probably the fix should\ngo there.\n\n-Peff\n"},{"id":"254562","messageId":"20150112211604.GB10409@peff.net","threadId":"38280","inReplyTo":"20150112210827.GA10409@peff.net","subject":"Re: profile-fast is failing in my Git 2.2.1 build from tar in a Git repo","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-01-12T21:16:05Z","receivedAt":"2015-01-12T21:16:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jan 12, 2015 at 04:08:28PM -0500, Jeff King wrote:\n\n> > I do not think profile build is prepared to be run without having\n> > our history (after all, it is not test_perf_create_REPO_from, not\n> > test_perf_create_source_directory_of_git_from).  It wants to create\n> > a repository that hosts a reasonably sized but not too big a\n> > project, i.e. us.\n> > \n> > The safest and cleanest fix would be to make sure that the said\n> > function checks if $source/.git is a repository, perhaps?\n> \n> Hmph. We already dealt with this once in 93b5393 (Makefile: make perf\n> tests optional for profile build, 2014-08-19). That check explicitly\n> looks for \".git\" (and not checking that we are in an outer git repo), so\n> I am not sure why it is kicking in at all. But probably the fix should\n> go there.\n\nOh, I see. It is because Paul is using profile-fast, which does not have\nthat check. And I did not add it as part of 93b5393, because it would\nnot make sense. If you do not do the perf tests, then profile-fast is\nliterally doing nothing. :)\n\nI think the right solution is either:\n\n  1. Switch to using \"make profile\", which will use the regular test\n     suite to gather data, and skip the perf tests.\n\n  2. Set GIT_PERF_REPO to some representative repo of your choice for\n     gathering profiling data (it does not have to be git.git at all,\n     but it is probably more useful if it is not a tiny toy repo).\n\nWe _could_ teach the perf code to look upwards for a surrounding repo\nwith `git rev-parse` rather than looking for ../../.git. But there is no\nguarantee that the repo we find would actually be a useful one for doing\nperf tests. I'd just as soon leave it as-is, and have people specify a\nuseful repo via GIT_PERF_REPO if they have one.\n\n-Peff\n"}]}