[libcamera-devel,v4.1,3/3] libcamera: Prevent merge conflicts

Message ID 20200401091553.28187-4-kieran.bingham@ideasonboard.com
State Not Applicable
Headers show
Series
  • Miscellaneous Code Improvements for mаster
Related show

Commit Message

Kieran Bingham April 1, 2020, 9:15 a.m. UTC
Merge conflicts are a terrible effect of rebasing code, and they impede
the development process.

Provide a useful helper header to ensure that merge-conflicts are no
longer an issue, and make sure that both sides of the conflict are
compile tested on average at least every other compile cycle. Based on
reliable advice from [0].

 [0] https://twitter.com/erdgeist/status/1197283439000637441

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/include/merge_conflicts.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 src/libcamera/include/merge_conflicts.h

Comments

Laurent Pinchart April 2, 2020, 10:45 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Wed, Apr 01, 2020 at 10:15:53AM +0100, Kieran Bingham wrote:
> Merge conflicts are a terrible effect of rebasing code, and they impede
> the development process.
> 
> Provide a useful helper header to ensure that merge-conflicts are no
> longer an issue, and make sure that both sides of the conflict are
> compile tested on average at least every other compile cycle. Based on
> reliable advice from [0].
> 
>  [0] https://twitter.com/erdgeist/status/1197283439000637441
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  src/libcamera/include/merge_conflicts.h | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>  create mode 100644 src/libcamera/include/merge_conflicts.h
> 
> diff --git a/src/libcamera/include/merge_conflicts.h b/src/libcamera/include/merge_conflicts.h
> new file mode 100644
> index 000000000000..6e5b69a78c7a
> --- /dev/null
> +++ b/src/libcamera/include/merge_conflicts.h
> @@ -0,0 +1,23 @@
> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> +/*
> + * Copyright (C) 2020, Kieran Bingham
> + *
> + * merge_conflicts.h - Automatic merge conflict resolution
> + */
> +
> +#ifndef __LIBCAMERA_MERGE_CONFLICT_H__
> +#define __LIBCAMERA_MERGE_CONFLICT_H__
> +
> +namespace libcamera {
> +
> +#ifndef __DOXYGEN__
> +
> +#define <<<<<<<< #if RANDOM % 2
> +#define ======== #else
> +#define >>>>>>>> #endif

I'm afraid this doesn't compile :-( Would you be able to work on a fix
with the priority deserved by the high added value ?

> +
> +#endif
> +
> +} /* namespace libcamera */
> +
> +#endif /* __LIBCAMERA_MERGE_CONFLICT_H__ */
Kieran Bingham April 2, 2020, 10:57 a.m. UTC | #2
Hi Laurent,

On 02/04/2020 11:45, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Wed, Apr 01, 2020 at 10:15:53AM +0100, Kieran Bingham wrote:
>> Merge conflicts are a terrible effect of rebasing code, and they impede
>> the development process.
>>
>> Provide a useful helper header to ensure that merge-conflicts are no
>> longer an issue, and make sure that both sides of the conflict are
>> compile tested on average at least every other compile cycle. Based on
>> reliable advice from [0].
>>
>>  [0] https://twitter.com/erdgeist/status/1197283439000637441
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> ---
>>  src/libcamera/include/merge_conflicts.h | 23 +++++++++++++++++++++++
>>  1 file changed, 23 insertions(+)
>>  create mode 100644 src/libcamera/include/merge_conflicts.h
>>
>> diff --git a/src/libcamera/include/merge_conflicts.h b/src/libcamera/include/merge_conflicts.h
>> new file mode 100644
>> index 000000000000..6e5b69a78c7a
>> --- /dev/null
>> +++ b/src/libcamera/include/merge_conflicts.h
>> @@ -0,0 +1,23 @@
>> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
>> +/*
>> + * Copyright (C) 2020, Kieran Bingham
>> + *
>> + * merge_conflicts.h - Automatic merge conflict resolution
>> + */
>> +
>> +#ifndef __LIBCAMERA_MERGE_CONFLICT_H__
>> +#define __LIBCAMERA_MERGE_CONFLICT_H__
>> +
>> +namespace libcamera {
>> +
>> +#ifndef __DOXYGEN__
>> +
>> +#define <<<<<<<< #if RANDOM % 2
>> +#define ======== #else
>> +#define >>>>>>>> #endif
> 
> I'm afraid this doesn't compile :-( Would you be able to work on a fix
> with the priority deserved by the high added value ?

I'm sorry for the confusion, I should have stated in the commit message.
It works perfectly when you upgrade your c-pre-processor to v20.4.1.

--
Kieran


>> +
>> +#endif
>> +
>> +} /* namespace libcamera */
>> +
>> +#endif /* __LIBCAMERA_MERGE_CONFLICT_H__ */
>

Patch

diff --git a/src/libcamera/include/merge_conflicts.h b/src/libcamera/include/merge_conflicts.h
new file mode 100644
index 000000000000..6e5b69a78c7a
--- /dev/null
+++ b/src/libcamera/include/merge_conflicts.h
@@ -0,0 +1,23 @@ 
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2020, Kieran Bingham
+ *
+ * merge_conflicts.h - Automatic merge conflict resolution
+ */
+
+#ifndef __LIBCAMERA_MERGE_CONFLICT_H__
+#define __LIBCAMERA_MERGE_CONFLICT_H__
+
+namespace libcamera {
+
+#ifndef __DOXYGEN__
+
+#define <<<<<<<< #if RANDOM % 2
+#define ======== #else
+#define >>>>>>>> #endif
+
+#endif
+
+} /* namespace libcamera */
+
+#endif /* __LIBCAMERA_MERGE_CONFLICT_H__ */