dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation
       [not found] <CGME20181218103020eucas1p144a1da4116ddbf8a06eb2846e88236d5@eucas1p1.samsung.com>
@ 2018-12-18 10:30 ` Andrzej Hajda
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 1/4] dim: allow git_dir to specify arbitrary work directory Andrzej Hajda
                     ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-12-18 10:30 UTC (permalink / raw)
  To: dri-devel, dim-tools; +Cc: Marek Szyprowski, Bartlomiej Zolnierkiewicz

Hi all,

This small patchset fixes issues with dim and git worktree's.
In v2 I have:
 - removed incorrect rr_cache_dir fix patch,
 - added patch fixing update_rerere_cache,
 - added patch converting git_dir function to use git rev_parse,
 - added R-Bs (thanks Daniel).

Regards
Andrzej


Andrzej Hajda (4):
  dim: allow git_dir to specify arbitrary work directory
  dim: fix git directory handling
  dim: fix update_rerere_cache
  dim: use git rev-parse to get git directory

 dim | 44 +++++++++++++++++---------------------------
 1 file changed, 17 insertions(+), 27 deletions(-)

-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [maintainer-tools PATCH v2 1/4] dim: allow git_dir to specify arbitrary work directory
  2018-12-18 10:30 ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Andrzej Hajda
@ 2018-12-18 10:30   ` Andrzej Hajda
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 2/4] dim: fix git directory handling Andrzej Hajda
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-12-18 10:30 UTC (permalink / raw)
  To: dri-devel, dim-tools; +Cc: Marek Szyprowski, Bartlomiej Zolnierkiewicz

git_dir function returns git directory for current working directory.
Allowing specifying any directory allows to reuse it more widely.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 dim | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index 70939ff..df66c58 100755
--- a/dim
+++ b/dim
@@ -565,10 +565,12 @@ function rr_cache_dir
 
 function git_dir
 {
-	if [ -d $PWD/.git ] ; then
-		echo $PWD/.git
+	local dir=${1:-$PWD}
+
+	if [ -d $dir/.git ] ; then
+		echo $dir/.git
 	else
-		cut -d ' ' -f 2 < $PWD/.git
+		cut -d ' ' -f 2 < $dir/.git
 	fi
 }
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [maintainer-tools PATCH v2 2/4] dim: fix git directory handling
  2018-12-18 10:30 ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Andrzej Hajda
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 1/4] dim: allow git_dir to specify arbitrary work directory Andrzej Hajda
@ 2018-12-18 10:30   ` Andrzej Hajda
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 3/4] dim: fix update_rerere_cache Andrzej Hajda
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-12-18 10:30 UTC (permalink / raw)
  To: dri-devel, dim-tools; +Cc: Marek Szyprowski, Bartlomiej Zolnierkiewicz

Assumption that git directory is always located at REPO/.git is incorrect,
especially in case of git worktrees. There is already function to deal
with it correctly - git_dir, let's then use it.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 dim | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/dim b/dim
index df66c58..3afa8b6 100755
--- a/dim
+++ b/dim
@@ -1088,12 +1088,7 @@ function dim_backmerge
 
 	git merge --rerere-autoupdate --no-commit $upstream >& /dev/null || true
 
-	if [[ -d .git ]]; then
-		patch_file=".git"
-	else
-		patch_file=$(cut -d ' ' -f 2 .git)
-	fi
-	patch_file=$patch_file/MERGE_MSG
+	patch_file=$(git_dir)/MERGE_MSG
 
 
 	cat > $patch_file <<-HERE
@@ -1340,7 +1335,7 @@ dim_alias_mrr=magic-rebase-resolve
 function dim_magic_rebase_resolve
 {
 	git diff HEAD | patch -p1 -R
-	dim_magic_patch < .git/rebase-merge/patch
+	dim_magic_patch < $(git_dir)/rebase-merge/patch
 	make $DIM_MAKE_OPTIONS
 	git add -u
 	git rebase --continue
@@ -2102,7 +2097,7 @@ function setup_aux_checkout # name url directory
 			git clone --reference=$DIM_PREFIX/$DIM_REPO/.git $url $dir
 			cd $dir
 			git config remote.origin.url $url
-			echo "$DIM_PREFIX/$DIM_REPO/.git/objects" > .git/objects/info/alternates
+			echo "$(git_dir $DIM_PREFIX/$DIM_REPO)/objects" > $(git_dir)/objects/info/alternates
 			git repack -a -d -l
 			remote=origin
 		fi
@@ -2132,7 +2127,7 @@ function dim_setup
 	fi
 	cd $DIM_PREFIX
 
-	if [ ! -d $DIM_PREFIX/$DIM_REPO/.git ]; then
+	if [ ! -d $(git_dir $DIM_PREFIX/$DIM_REPO) ]; then
 		echoerr "No git checkout found in $DIM_PREFIX/$DIM_REPO."
 		echoerr "Please set up your maintainer linux repository at $DIM_PREFIX/$DIM_REPO with"
 		echoerr "    cd $DIM_PREFIX"
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [maintainer-tools PATCH v2 3/4] dim: fix update_rerere_cache
  2018-12-18 10:30 ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Andrzej Hajda
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 1/4] dim: allow git_dir to specify arbitrary work directory Andrzej Hajda
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 2/4] dim: fix git directory handling Andrzej Hajda
@ 2018-12-18 10:30   ` Andrzej Hajda
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 4/4] dim: use git rev-parse to get git directory Andrzej Hajda
  2018-12-18 12:33   ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Daniel Vetter
  4 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-12-18 10:30 UTC (permalink / raw)
  To: dri-devel, dim-tools; +Cc: Marek Szyprowski, Bartlomiej Zolnierkiewicz

update_rerere_cache does not work correctly if drm-tip and $DIM_REPO are
workdirs - it cannot locate properly rr-cache. Let's use git rev-parse
to resolve rr-cache location.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 dim | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/dim b/dim
index 3afa8b6..e4a4afe 100755
--- a/dim
+++ b/dim
@@ -554,15 +554,6 @@ function check_conflicts # tree
 	true
 }
 
-function rr_cache_dir
-{
-	if [ -d $DIM_PREFIX/drm-tip/.git/ ] ; then
-		echo $DIM_PREFIX/drm-tip/.git/rr-cache
-	else
-		echo $DIM_PREFIX/$DIM_REPO/.git/rr-cache
-	fi
-}
-
 function git_dir
 {
 	local dir=${1:-$PWD}
@@ -606,17 +597,25 @@ function pull_rerere_cache
 
 function update_rerere_cache
 {
+	local rr_cache_dir
+
 	echo -n "Updating rerere cache... "
 
 	pull_rerere_cache
 
-	if [ ! -L $(rr_cache_dir) ] ; then
-		if [ -d $(rr_cache_dir) ] ; then
-			rm -Rf $(rr_cache_dir)
+	cd $DIM_PREFIX/drm-tip/
+
+	rr_cache_dir=$(git rev-parse --git-common-dir)/rr-cache
+
+	if [ ! -L $rr_cache_dir ] ; then
+		if [ -d $rr_cache_dir ] ; then
+			rm -Rf $rr_cache_dir
 		fi
-		ln -s "$DIM_PREFIX/drm-rerere/rr-cache" $(dirname $(rr_cache_dir))
+		ln -s "$DIM_PREFIX/drm-rerere/rr-cache" $rr_cache_dir
 	fi
 
+	cd ~-
+
 	echo "Done."
 }
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [maintainer-tools PATCH v2 4/4] dim: use git rev-parse to get git directory
  2018-12-18 10:30 ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Andrzej Hajda
                     ` (2 preceding siblings ...)
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 3/4] dim: fix update_rerere_cache Andrzej Hajda
@ 2018-12-18 10:30   ` Andrzej Hajda
  2018-12-18 12:33   ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Daniel Vetter
  4 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-12-18 10:30 UTC (permalink / raw)
  To: dri-devel, dim-tools; +Cc: Marek Szyprowski, Bartlomiej Zolnierkiewicz

Using rev-parse git option is safer than manually parsing git files.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 dim | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/dim b/dim
index e4a4afe..e999409 100755
--- a/dim
+++ b/dim
@@ -556,13 +556,7 @@ function check_conflicts # tree
 
 function git_dir
 {
-	local dir=${1:-$PWD}
-
-	if [ -d $dir/.git ] ; then
-		echo $dir/.git
-	else
-		cut -d ' ' -f 2 < $dir/.git
-	fi
+	git -C ${1:-$PWD} rev-parse --absolute-git-dir
 }
 
 function pull_rerere_cache
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation
  2018-12-18 10:30 ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Andrzej Hajda
                     ` (3 preceding siblings ...)
  2018-12-18 10:30   ` [maintainer-tools PATCH v2 4/4] dim: use git rev-parse to get git directory Andrzej Hajda
@ 2018-12-18 12:33   ` Daniel Vetter
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2018-12-18 12:33 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Bartlomiej Zolnierkiewicz, dim-tools, dri-devel, Marek Szyprowski

On Tue, Dec 18, 2018 at 11:30:12AM +0100, Andrzej Hajda wrote:
> Hi all,
> 
> This small patchset fixes issues with dim and git worktree's.
> In v2 I have:
>  - removed incorrect rr_cache_dir fix patch,
>  - added patch fixing update_rerere_cache,
>  - added patch converting git_dir function to use git rev_parse,
>  - added R-Bs (thanks Daniel).

Entire series applied, thanks for your patches.
-Daniel

> 
> Regards
> Andrzej
> 
> 
> Andrzej Hajda (4):
>   dim: allow git_dir to specify arbitrary work directory
>   dim: fix git directory handling
>   dim: fix update_rerere_cache
>   dim: use git rev-parse to get git directory
> 
>  dim | 44 +++++++++++++++++---------------------------
>  1 file changed, 17 insertions(+), 27 deletions(-)
> 
> -- 
> 2.17.1
> 
> _______________________________________________
> dim-tools mailing list
> dim-tools@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-18 12:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20181218103020eucas1p144a1da4116ddbf8a06eb2846e88236d5@eucas1p1.samsung.com>
2018-12-18 10:30 ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Andrzej Hajda
2018-12-18 10:30   ` [maintainer-tools PATCH v2 1/4] dim: allow git_dir to specify arbitrary work directory Andrzej Hajda
2018-12-18 10:30   ` [maintainer-tools PATCH v2 2/4] dim: fix git directory handling Andrzej Hajda
2018-12-18 10:30   ` [maintainer-tools PATCH v2 3/4] dim: fix update_rerere_cache Andrzej Hajda
2018-12-18 10:30   ` [maintainer-tools PATCH v2 4/4] dim: use git rev-parse to get git directory Andrzej Hajda
2018-12-18 12:33   ` [maintainer-tools PATCH v2 0/4] dim: fix git directory evaluation Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).