Sir, I have attached the patch file with this mail. I have tried to follow all the conventions that were listed in the User Git page. I request you to please check and guide me whether I have done it correctly or not or whether something more is to be done.
Thanks and Regards Abhinav Jain On Tue, Feb 20, 2018 at 4:13 AM, Chris Johns <chr...@rtems.org> wrote: > On 19/02/2018 21:19, Abhinav Jain wrote: > > I have made the changes suggested by you in the code and hopefully, the > issue > > will be resolved as if the .git file is not found in the directory, the > process > > will not go ahead and hence the wrong git repository will not be changed. > > Excellent. Please post for review. > > > I request to please guide me whether anything more is to be done in the > code or > > should I proceed with a pull request. > > I assume you mean a github pull request. RTEMS uses patches sent to this > list > for review. The top page of the Wiki has a section called RTEMS Developer > Information and in that section are links to User Git access and submitting > patches. You can also attach the patch to the ticket. > > Chris >
From 273baf1527f50ae6dd4832ddf9434a9f4630375a Mon Sep 17 00:00:00 2001 From: Abhinav Jain <abhi2...@github.com> Date: Mon, 19 Feb 2018 15:35:59 +0530 Subject: [PATCH] Function added to check the validity of git repository. Earlier the function valid was checking the validity of the git repository, the program was working in. For doing this the function was first checking whether path exists or not and after that it was checking whether the directory is a git repository or not and to do so, it was relying on git status. The git status looks for the .git file in the current directory and if not found it will look up in the tree and if finds a .git file there it will return valid, which voids the purpose of use. Now to solve this problem, a function _valid_repo_path is created to check for the .git file and every function which looks for the validity of git repository will call this function to check. --- source-builder/sb/git.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source-builder/sb/git.py b/source-builder/sb/git.py index be23396..82b23fb 100644 --- a/source-builder/sb/git.py +++ b/source-builder/sb/git.py @@ -38,9 +38,13 @@ class repo: if ec: raise error.general('git command failed (%s): %d' % (self.git, ec)) + + def _valid_repo_path(self): + return path.exists(path.join(self.path, '.git')) + def _run(self, args, check = False): e = execute.capture_execution() - if path.exists(self.path): + if _valid_repo_path(): cwd = self.path else: cwd = None @@ -52,6 +56,7 @@ class repo: self._git_exit_code(exit_code) return exit_code, output + def __init__(self, _path, opts = None, macros = None): self.path = _path self.opts = opts @@ -122,7 +127,7 @@ class repo: def status(self, submodules_always_clean = False): _status = {} - if path.exists(self.path): + if _valid_repo_path(): if submodules_always_clean: submodules = self.submodules() else: @@ -166,7 +171,7 @@ class repo: return not (len(_status) == 1 and 'branch' in _status) def valid(self): - if path.exists(self.path): + if _valid_repo_path(): ec, output = self._run(['status']) return ec == 0 return False -- 1.9.1
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel